#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 35;
const int MOD = 1e9 + 7;
ll n;
ll a[N][N];
void matmul(ll a[N][N], ll b[N][N], ll c[N][N]) {
  ll res[N][N] = {0};
  rep(i, 0, 25) rep(j, 0, 25) rep(k, 0, 25) {
    res[i][j] = (res[i][j] + a[i][k] * b[k][j] % MOD) % MOD;
  }
  rep(i, 0, 25) rep(j, 0, 25) c[i][j] = res[i][j];
}
void matpow(ll b[N][N], ll p, ll c[N][N]) {
  ll res[N][N] = {0};
  rep(i, 0, 25) res[i][i] = 1;
  while (p) {
    if (p & 1) matmul(res, b, res);
    matmul(b, b, b);
    p >>= 1;
  }
  rep(i, 0, 25) rep(j, 0, 25) c[i][j] = res[i][j];
}
void out(ll a[N][N]) {
  rep(i, 0, 25) {
    rep(j, 0, 25) cout << a[i][j] << ' ';
    cout << endl;
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  if (n == 1) {
    cout << 26;
    return 0;
  }
  string s;
  cin >> s;
  int len = s.size();
  rep(i, 0, len - 2) {
    ll x = s[i] - 'a', y = s[i + 1] - 'a';
    a[x][y] = 1;
  }
  rep(i, 0, 25) rep(j, 0, 25) a[i][j] ^= 1;
  matpow(a, n - 1, a);
  ll ans = 0;
  rep(i, 0, 25) rep(j, 0, 25) ans = (ans + a[i][j]) % MOD;
  cout << ans;
  return 0;
}